package com.edu.service.impl;

import java.util.List;

import com.edu.bean.News;
import com.edu.bean.Page;
import com.edu.dao.NewsDao;
import com.edu.dao.impl.NewsDaoImpl;
import com.edu.service.NewsService;

public class NewsServiceImpl implements NewsService {
	NewsDao nd = new NewsDaoImpl();
	@Override
	public Page<News> getAllNews(News news,int pageNum,int pageSize) {
		List<News> newsPage = nd.getAllNews(pageNum, pageSize);
		int row = nd.selectNewsall(news);
		Page<News> page = new Page(newsPage, pageNum, pageSize, row);
		return page;
		
	}
	@Override
	public int addNews(News news) {
		// TODO Auto-generated method stub
		return nd.addNews(news);
	}

	@Override
	public int deleteNews(int id) {
		// TODO Auto-generated method stub
		return nd.deleteNews(id);
	}

	@Override
	public List<News> getLatestNews(int count) {
		// TODO Auto-generated method stub
		return nd.getLatestNews(count);
	}

	@Override
	public List<News> searchNewsByTitle(String keyword) {
		// TODO Auto-generated method stub
		return nd.searchNewsByTitle(keyword);
	}
	@Override
	public int updatenews(News news) {
		// TODO Auto-generated method stub
		return nd.updatenews(news);
	}
	@Override
	public News selectnewsid(int id) {
		// TODO Auto-generated method stub
		return nd.selectnewsid(id);
	}

}
